package cn.dnui_jzy913.dnuifood_16110100913.Adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import java.util.List;

import cn.dnui_jzy913.dnuifood_16110100913.R;
import cn.dnui_jzy913.dnuifood_16110100913.bean.ShopBean;
import cn.dnui_jzy913.dnuifood_16110100913.Activity.FoodListActivity;
import cn.dnui_jzy913.dnuifood_16110100913.model.UserModel;

public class sAdapter extends RecyclerView.Adapter<sAdapter.MyViewHolder> {
    private LayoutInflater mInflater;
    private Context mContext;
    private List<String> mDatas;

    public sAdapter(Context context, List<String> datas){
        this.mContext = context;
        this.mDatas = datas;
        mInflater = LayoutInflater.from(context);
    }
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = mInflater.inflate(R.layout.item,parent,false);
        MyViewHolder viewHolder = new MyViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        holder.tv.setText(mDatas.get(position));
        holder.ratingBar.setRating(3);
    }

    @Override
    public int getItemCount() {
        return mDatas.size();
    }

    public static class MyViewHolder extends RecyclerView.ViewHolder{
        TextView tv;
        RatingBar ratingBar;
        public MyViewHolder(View itemView) {
            super(itemView);
            tv = itemView.findViewById(R.id.item_txt);
            ratingBar = itemView.findViewById(R.id.xbar);
        }
    }
}
